<template>
  <div class="buy absolute">
    <div class="back">
      <img src="http://diandian.zgkpz.com/images/m_get/back.png" />
    </div>
    <div class="main">
      <div class="toubu">
        <div>
          <img src="http://diandian.zgkpz.com/images/class/quan.png" />
        </div>
        <div class="toubu_info">
          <span>大宝DSD</span>
          <p>购买商品享受多重优惠</p>
        </div>
      </div>
      <div>
        <img src="http://diandian.zgkpz.com/images/class/gou.png" class="gou" />
      </div>
      <div class="swiper-container">
        <div class="swiper-wrapper">
          <div class="swiper-slide">
            <div class="content">
              <h2>听音识图全年课程</h2>
              <small>超值优惠</small>
              <p>
                ·小学，初中，高中6000单词量 ·15000个关卡
                ·45万个句型，上百万次重复 ·听说读写一网打尽，顺便考高分
              </p>
              <span>￥4680元</span>
            </div>
          </div>
          <div class="swiper-slide">
            <div class="content">
              <h2>听音识图全年课程</h2>
              <small>超值优惠</small>
              <p>
                ·小学，初中，高中6000单词量 ·15000个关卡
                ·45万个句型，上百万次重复 ·听说读写一网打尽，顺便考高分
              </p>
              <span>￥4680元</span>
            </div>
          </div>
          <div class="swiper-slide">
            <div class="content">
              <h2>听音识图全年课程</h2>
              <small>超值优惠</small>
              <p>
                ·小学，初中，高中6000单词量 ·15000个关卡
                ·45万个句型，上百万次重复 ·听说读写一网打尽，顺便考高分
              </p>
              <span>￥4680元</span>
            </div>
          </div>
          <div class="swiper-slide">
            <div class="content">
              <h2>听音识图全年课程</h2>
              <small>超值优惠</small>
              <p>
                ·小学，初中，高中6000单词量 ·15000个关卡
                ·45万个句型，上百万次重复 ·听说读写一网打尽，顺便考高分
              </p>
              <span>￥4680元</span>
            </div>
          </div>
        </div>
        <div class="swiper-pagination"></div>
      </div>
    </div>
  </div>
</template>
<script>
import Swiper from "swiper";
import "swiper/dist/css/swiper.min.css";
export default {
  data() {
    return {};
  },
  methods: {
    handleResize() {
      let Ipad =
        document.body.clientWidth == 1024 && document.body.clientHeight == 768;
      let IpadPro =
        document.body.clientWidth == 1024 && document.body.clientHeight == 1366;
      let IpadProT =
        document.body.clientWidth == 1366 && document.body.clientHeight == 1024;
      if (document.body.clientWidth >= 770 && !Ipad && !IpadPro && !IpadProT) {
        this.$router.replace({ path: "/web/buy" });
      }
    },
  },
  created() {
    window.addEventListener("resize", this.handleResize);
  },
  mounted() {
    var swiper = new Swiper(".swiper-container", {
      slidesPerView: "auto",
      spaceBetween: 1,
      centeredSlides: true,
      loop: true,
      pagination: {
        el: ".swiper-pagination",
        clickable: true,
      },
    });
  },
};
</script>

<style scoped>
.back img {
  width: 1.5rem;
}
.gou {
  width: 1rem;
  position: relative;
  top: 5.8rem;
  z-index: 999;
  left: 1.7rem;
}
.main {
  font-family: SimHei;
  text-align: center;
}
.toubu {
  width: 5rem;
  display: inline-flex;
  justify-content: space-around;
  margin-bottom: 0.2rem;
  text-align: left;
  align-items: center;
}
.toubu_info {
  line-height: 0.6rem;
}
.toubu img {
  background: url("http://diandian.zgkpz.com/images/index/touxiang.png")
    no-repeat;
  background-size: 1.3rem;
  width: 1.4rem;
  background-position-x: 0.05rem;
  background-position-y: 0.05rem;
}
.toubu span {
  color: #ffffff;
  font-size: 0.35rem;
}
.toubu p {
  color: #3514ff;
  font-size: 0.3rem;
}
html,
body {
  position: relative;
  height: 100%;
}
body {
  background: #eee;
  font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: #000;
  margin: 0;
  padding: 0;
}
.swiper-container {
  width: 100%;
  height: 100%;
}
.swiper-slide {
  text-align: center;
  font-size: 18px;
  background: url("http://diandian.zgkpz.com/images/class/proback.png")
    no-repeat;
  background-size: 100% 100%;
  height: 6rem;
  display: block;
  width: 5rem !important;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  -webkit-box-align: center;
  -ms-flex-align: center;
  -webkit-align-items: center;
  align-items: center;
  transition: 300ms;
  transform: scale(0.8);
}
.swiper-slide-active,
.swiper-slide-duplicate-active {
  transform: scale(1);
}
.content {
  width: 3.8rem;
  text-align: left;
  margin-left: 0.45rem;
}
.content h2 {
  margin-top: 0.3rem;
  color: #ffffff;
}
.content small {
  margin-top: 0.3rem;
  color: #feff81;
  display: block;
}
.content p {
  margin-top: 0.6rem;
  color: #0c1f66;
  font-size: 0.25rem;
  padding: 0.1rem;
}
.content span {
  margin-top: 1rem;
  color: #feff81;
  display: block;
}
.code img {
  width: 100%;
  height: 100%;
}
.back img {
  padding: 0.3rem;
}
/* ipad竖屏 */
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
  .swiper-container {
    position: absolute;
    top: 33%;
  }
  .content {
    font-size: 0.3rem;
  }
  .content h2 {
    margin-top: 0.5rem;
  }
  .content small {
    font-size: 0.24rem;
  }
  .content p {
    margin-top: 0.2rem;
    font-size: 0.3rem;
  }
  .gou {
    top: 4.82rem;
    left: 1.74rem;
  }
}
/* ipad横屏 */
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: landscape) {
  .back img {
    width: 1rem;
    position: absolute;
  }
  .swiper-container {
    top: 0%;
  }
  .toubu {
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
  }
  .toubu img {
    background-size: 0.7rem;
    width: 0.8rem;
  }
  .toubu_info[data-v-2a65d493] {
    line-height: 0.4rem;
  }
  div.swiper-slide {
    height: 3rem;
    width: 3rem !important;
  }
  .content {
    margin-left: 0.3rem;
  }
  .content small {
    margin-top: 0.1rem;
    font-size: 0.13rem;
  }
  .content p {
    margin-top: 0.2rem;
    font-size: 0.15rem;
    width: 2.3rem;
    padding: 0.02rem;
  }
  .content span {
    margin-top: 0.7rem;
    font-size: 0.2rem;
  }
  .gou {
    top: 4.15rem;
    left: 1.055rem;
    width: 0.58rem;
  }
  .content h2 {
    margin-top: 0.16rem;
    font-size: 0.2rem;
  }
}
/* ipad pro */
@media only screen and (min-device-width: 1024px) and (max-device-width: 1366px) and (-webkit-min-device-pixel-ratio: 1.5) {
  .back img {
    position: absolute;
    width: 1.2rem;
  }
  .toubu img {
    background-size: 0.9rem;
    width: 1rem;
  }
  .toubu {
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
  }
}
/* pro竖屏 */
@media only screen and (min-device-width: 1024px) and (max-device-width: 1366px) and (orientation: portrait) and (-webkit-min-device-pixel-ratio: 1.5) {
  .toubu {
    top: 15%;
  }
  .gou {
    top: 8.05rem;
    left: 1.7rem;
  }
}
/* pro横屏 */
@media only screen and (min-device-width: 1024px) and (max-device-width: 1366px) and (orientation: landscape) and (-webkit-min-device-pixel-ratio: 1.5) {
  .toubu_info {
    line-height: 0.4rem;
  }
  div.swiper-slide {
    margin-top: 2rem;
    height: 3rem;
    width: 3rem !important;
  }
  .content {
    margin-left: 0.3rem;
  }
  .content p {
    margin-top: 0.09rem;
    font-size: 0.16rem;
    padding: 0.1rem;
    width: 2.3rem;
  }
  .content h2 {
    margin-top: 0.22rem;
    color: #ffffff;
    font-size: 0.17rem;
  }
  .content small[data-v-2a65d493] {
    margin-top: 0.16rem;
    color: #feff81;
    font-size: 0.15rem;
  }
  .content span {
    margin-top: 0.6rem;
    color: #feff81;
    display: block;
    font-size: 0.2rem;
  }
  .gou {
    width: 0.5rem;
    position: absolute;
    top: 4.37rem;
    z-index: 999;
    left: 4.57rem;
  }
}
</style>
